#include "DriverAPI.h"
#include"HelperManager.h"
#include<QMutex>



static string driverError;

QMutex driverLock;
SDKDRIVER_EXPORT IComponentHelper * getHelper(const string helperId)
{
	if (helperId.empty()) {
		return nullptr;
	}
	driverLock.lock();
	IComponentHelper* pInterface = HelperManager::getInstance()->getHelper(helperId);
	if (pInterface == nullptr){
		driverLock.unlock();
		return nullptr;
	}
	driverLock.unlock();
	return pInterface;
}

SDKDRIVER_EXPORT IComponent* getComponent(const string helperId, const string componentId)
{
	IComponentHelper* helper = getHelper(helperId);
	if (helper) {
		return helper->getComponent(componentId);
	}
	return nullptr;
}




